home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume20 / reactivekbd / part02 < prev    next >
Encoding:
Internet Message Format  |  1989-10-16  |  51.7 KB

  1. Subject:  v20i030:  Command-line editor with predictions, Part02/04
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Mark James <jamesm@cpsc.UCalgary.CA>
  7. Posting-number: Volume 20, Issue 30
  8. Archive-name: reactivekbd/part02
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 2 (of 4)."
  17. # Contents:  getopt.c parse_keys.c rk.1
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f 'getopt.c' -a "${1}" != "-c" ; then 
  20.   echo shar: Will not clobber existing file \"'getopt.c'\"
  21. else
  22. echo shar: Extracting \"'getopt.c'\" \(16259 characters\)
  23. sed "s/^X//" >'getopt.c' <<'END_OF_FILE'
  24. X
  25. X#undef _POSIX_OPTION_ORDER
  26. X
  27. X/* Getopt for GNU.
  28. X   Modified by David MacKenzie to use malloc and free instead of alloca,
  29. X   and memcpy instead of bcopy under System V.
  30. X   Copyright (C) 1987 Free Software Foundation, Inc.
  31. X
  32. X               NO WARRANTY
  33. X
  34. X  BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
  35. XNO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
  36. XWHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
  37. XRICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
  38. XWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  39. XBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  40. XFITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  41. XAND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
  42. XDEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
  43. XCORRECTION.
  44. X
  45. X IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
  46. XSTALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
  47. XWHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
  48. XLIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
  49. XOTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  50. XUSE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
  51. XDATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
  52. XA FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
  53. XPROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
  54. XDAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  55. X
  56. X        GENERAL PUBLIC LICENSE TO COPY
  57. X
  58. X  1. You may copy and distribute verbatim copies of this source file
  59. Xas you receive it, in any medium, provided that you conspicuously and
  60. Xappropriately publish on each copy a valid copyright notice "Copyright
  61. X (C) 1987 Free Software Foundation, Inc."; and include following the
  62. Xcopyright notice a verbatim copy of the above disclaimer of warranty
  63. Xand of this License.  You may charge a distribution fee for the
  64. Xphysical act of transferring a copy.
  65. X
  66. X  2. You may modify your copy or copies of this source file or
  67. Xany portion of it, and copy and distribute such modifications under
  68. Xthe terms of Paragraph 1 above, provided that you also do the following:
  69. X
  70. X    a) cause the modified files to carry prominent notices stating
  71. X    that you changed the files and the date of any change; and
  72. X
  73. X    b) cause the whole of any work that you distribute or publish,
  74. X    that in whole or in part contains or is a derivative of this
  75. X    program or any part thereof, to be licensed at no charge to all
  76. X    third parties on terms identical to those contained in this
  77. X    License Agreement (except that you may choose to grant more
  78. X    extensive warranty protection to third parties, at your option).
  79. X
  80. X    c) You may charge a distribution fee for the physical act of
  81. X    transferring a copy, and you may at your option offer warranty
  82. X    protection in exchange for a fee.
  83. X
  84. X  3. You may copy and distribute this program or any portion of it in
  85. Xcompiled, executable or object code form under the terms of Paragraphs
  86. X1 and 2 above provided that you do the following:
  87. X
  88. X    a) cause each such copy to be accompanied by the
  89. X    corresponding machine-readable source code, which must
  90. X    be distributed under the terms of Paragraphs 1 and 2 above; or,
  91. X
  92. X    b) cause each such copy to be accompanied by a
  93. X    written offer, with no time limit, to give any third party
  94. X    free (except for a nominal shipping charge) a machine readable
  95. X    copy of the corresponding source code, to be distributed
  96. X    under the terms of Paragraphs 1 and 2 above; or,
  97. X
  98. X    c) in the case of a recipient of this program in compiled, executable
  99. X    or object code form (without the corresponding source code) you
  100. X    shall cause copies you distribute to be accompanied by a copy
  101. X    of the written offer of source code which you received along
  102. X    with the copy you received.
  103. X
  104. X  4. You may not copy, sublicense, distribute or transfer this program
  105. Xexcept as expressly provided under this License Agreement.  Any attempt
  106. Xotherwise to copy, sublicense, distribute or transfer this program is void and
  107. Xyour rights to use the program under this License agreement shall be
  108. Xautomatically terminated.  However, parties who have received computer
  109. Xsoftware programs from you with this License Agreement will not have
  110. Xtheir licenses terminated so long as such parties remain in full compliance.
  111. X
  112. X  5. If you wish to incorporate parts of this program into other free
  113. Xprograms whose distribution conditions are different, write to the Free
  114. XSoftware Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
  115. Xworked out a simple rule that can be stated here, but we will often permit
  116. Xthis.  We will be guided by the two goals of preserving the free status of
  117. Xall derivatives of our free software and of promoting the sharing and reuse of
  118. Xsoftware.
  119. X
  120. X
  121. XIn other words, you are welcome to use, share and improve this program.
  122. XYou are forbidden to forbid anyone else to use, share and improve
  123. Xwhat you give them.   Help stamp out software-hoarding!  */
  124. X
  125. X/* This version of `getopt' appears to the caller like standard Unix `getopt'
  126. X   but it behaves differently for the user, since it allows the user
  127. X   to intersperse the options with the other arguments.
  128. X
  129. X   As `getopt' works, it permutes the elements of `argv' so that,
  130. X   when it is done, all the options precede everything else.  Thus
  131. X   all application programs are extended to handle flexible argument order.
  132. X
  133. X   Setting the environment variable _POSIX_OPTION_ORDER disables permutation.
  134. X   Then the behavior is completely standard.
  135. X
  136. X   GNU application programs can use a third alternative mode in which
  137. X   they can distinguish the relative order of options and other arguments.  */
  138. X
  139. X#include <stdio.h>
  140. X
  141. X#if SYSV || SYSVR3
  142. X#define bcopy(s, d, l) memcpy((d), (s), (l))
  143. X#define index strchr
  144. X#endif
  145. X
  146. X/* For communication from `getopt' to the caller.
  147. X   When `getopt' finds an option that takes an argument,
  148. X   the argument value is returned here.
  149. X   Also, when `ordering' is RETURN_IN_ORDER,
  150. X   each non-option ARGV-element is returned here.  */
  151. X
  152. Xchar *optarg = 0;
  153. X
  154. X/* Index in ARGV of the next element to be scanned.
  155. X   This is used for communication to and from the caller
  156. X   and for communication between successive calls to `getopt'.
  157. X
  158. X   On entry to `getopt', zero means this is the first call; initialize.
  159. X
  160. X   When `getopt' returns EOF, this is the index of the first of the
  161. X   non-option elements that the caller should itself scan.
  162. X
  163. X   Otherwise, `optind' communicates from one call to the next
  164. X   how much of ARGV has been scanned so far.  */
  165. X
  166. Xint optind = 0;
  167. X
  168. X/* The next char to be scanned in the option-element
  169. X   in which the last option character we returned was found.
  170. X   This allows us to pick up the scan where we left off.
  171. X
  172. X   If this is zero, or a null string, it means resume the scan
  173. X   by advancing to the next ARGV-element.  */
  174. X
  175. Xstatic char *nextchar;
  176. X
  177. X/* Callers store zero here to inhibit the error message
  178. X   for unrecognized options.  */
  179. X
  180. Xint opterr = 1;
  181. X
  182. X/* Describe how to deal with options that follow non-option ARGV-elements.
  183. X
  184. X   UNSPECIFIED means the caller did not specify anything;
  185. X   the default is then REQUIRE_ORDER if the environment variable
  186. X   _OPTIONS_FIRST is defined, PERMUTE otherwise.
  187. X
  188. X   REQUIRE_ORDER means don't recognize them as options.
  189. X   Stop option processing when the first non-option is seen.
  190. X   This is what Unix does.
  191. X
  192. X   PERMUTE is the default.  We permute the contents of `argv' as we scan,
  193. X   so that eventually all the options are at the end.  This allows options
  194. X   to be given in any order, even with programs that were not written to
  195. X   expect this.
  196. X
  197. X   RETURN_IN_ORDER is an option available to programs that were written
  198. X   to expect options and other ARGV-elements in any order and that care about
  199. X   the ordering of the two.  We describe each non-option ARGV-element
  200. X   as if it were the argument of an option with character code zero.
  201. X   Using `-' as the first character of the list of option characters
  202. X   requests this mode of operation.
  203. X
  204. X   The special argument `--' forces an end of option-scanning regardless
  205. X   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
  206. X   `--' can cause `getopt' to return EOF with `optind' != ARGC.  */
  207. X
  208. Xstatic enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering;
  209. X
  210. Xchar *malloc ();
  211. X
  212. X/* Allocate memory dynamically, with error checking.  */
  213. X
  214. Xstatic char *
  215. Xxmalloc (n)
  216. X  unsigned n;
  217. X{
  218. X  char *p;
  219. X
  220. X  p = malloc (n);
  221. X  if (!p)
  222. X    {
  223. X      fprintf (stderr, "Virtual memory exhausted\n");
  224. X      exit (1);
  225. X    }
  226. X  return p;
  227. X}
  228. X
  229. X/* Handle permutation of arguments.  */
  230. X
  231. X/* Describe the part of ARGV that contains non-options that have
  232. X   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
  233. X   `last_nonopt' is the index after the last of them.  */
  234. X
  235. Xstatic int first_nonopt;
  236. Xstatic int last_nonopt;
  237. X
  238. X/* Exchange two adjacent subsequences of ARGV.
  239. X   One subsequence is elements [first_nonopt,last_nonopt)
  240. X    which contains all the non-options that have been skipped so far.
  241. X   The other is elements [last_nonopt,optind), which contains all
  242. X    the options processed since those non-options were skipped.
  243. X
  244. X   `first_nonopt' and `last_nonopt' are relocated so that they describe
  245. X    the new indices of the non-options in ARGV after they are moved.  */
  246. X
  247. Xstatic void
  248. Xexchange (argv)
  249. X     char **argv;
  250. X{
  251. X  int nonopts_size
  252. X    = (last_nonopt - first_nonopt) * sizeof (char *);
  253. X  char **temp = (char **) xmalloc (nonopts_size);
  254. X
  255. X  /* Interchange the two blocks of data in argv.  */
  256. X
  257. X  bcopy (&argv[first_nonopt], temp, nonopts_size);
  258. X  bcopy (&argv[last_nonopt], &argv[first_nonopt],
  259. X     (optind - last_nonopt) * sizeof (char *));
  260. X  bcopy (temp, &argv[first_nonopt + optind - last_nonopt],
  261. X     nonopts_size);
  262. X
  263. X  free (temp);
  264. X
  265. X  /* Update records for the slots the non-options now occupy.  */
  266. X
  267. X  first_nonopt += (optind - last_nonopt);
  268. X  last_nonopt = optind;
  269. X}
  270. X
  271. X/* Scan elements of ARGV (whose length is ARGC) for option characters
  272. X   given in OPTSTRING.
  273. X
  274. X   If an element of ARGV starts with '-', and is not exactly "-" or "--",
  275. X   then it is an option element.  The characters of this element
  276. X   (aside from the initial '-') are option characters.  If `getopt'
  277. X   is called repeatedly, it returns successively each of the option characters
  278. X   from each of the option elements.
  279. X
  280. X   If `getopt' finds another option character, it returns that character,
  281. X   updating `optind' and `nextchar' so that the next call to `getopt' can
  282. X   resume the scan with the following option character or ARGV-element.
  283. X
  284. X   If there are no more option characters, `getopt' returns `EOF'.
  285. X   Then `optind' is the index in ARGV of the first ARGV-element
  286. X   that is not an option.  (The ARGV-elements have been permuted
  287. X   so that those that are not options now come last.)
  288. X
  289. X   OPTSTRING is a string containing the legitimate option characters.
  290. X   A colon in OPTSTRING means that the previous character is an option
  291. X   that wants an argument.  The argument is taken from the rest of the
  292. X   current ARGV-element, or from the following ARGV-element,
  293. X   and returned in `optarg'.
  294. X
  295. X   If an option character is seen that is not listed in OPTSTRING,
  296. X   return '?' after printing an error message.  If you set `opterr' to
  297. X   zero, the error message is suppressed but we still return '?'.
  298. X
  299. X   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
  300. X   so the following text in the same ARGV-element, or the text of the following
  301. X   ARGV-element, is returned in `optarg.  Two colons mean an option that
  302. X   wants an optional arg; if there is text in the current ARGV-element,
  303. X   it is returned in `optarg'.
  304. X
  305. X   If OPTSTRING starts with `-', it requests a different method of handling the
  306. X   non-option ARGV-elements.  See the comments about RETURN_IN_ORDER, above.
  307. X */
  308. X
  309. Xint
  310. Xgetopt (argc, argv, optstring)
  311. X     int argc;
  312. X     char **argv;
  313. X     char *optstring;
  314. X{
  315. X  /* Initialize the internal data when the first call is made.
  316. X     Start processing options with ARGV-element 1 (since ARGV-element 0
  317. X     is the program name); the sequence of previously skipped
  318. X     non-option ARGV-elements is empty.  */
  319. X
  320. X  if (optind == 0)
  321. X    {
  322. X      first_nonopt = last_nonopt = optind = 1;
  323. X
  324. X      nextchar = 0;
  325. X
  326. X      /* Determine how to handle the ordering of options and nonoptions.  */
  327. X
  328. X      if (optstring[0] == '-')
  329. X    ordering = RETURN_IN_ORDER;
  330. X      else if (getenv ("_POSIX_OPTION_ORDER") != 0)
  331. X    ordering = REQUIRE_ORDER;
  332. X      else
  333. X    ordering = PERMUTE;
  334. X    }
  335. X
  336. X  if (nextchar == 0 || *nextchar == 0)
  337. X    {
  338. X      if (ordering == PERMUTE)
  339. X    {
  340. X      /* If we have just processed some options following some non-options,
  341. X         exchange them so that the options come first.  */
  342. X
  343. X      if (first_nonopt != last_nonopt && last_nonopt != optind)
  344. X        exchange (argv);
  345. X      else if (last_nonopt != optind)
  346. X        first_nonopt = optind;
  347. X
  348. X      /* Now skip any additional non-options
  349. X         and extend the range of non-options previously skipped.  */
  350. X
  351. X      while (optind < argc
  352. X         && (argv[optind][0] != '-'
  353. X             || argv[optind][1] == 0))
  354. X        optind++;
  355. X      last_nonopt = optind;
  356. X    }
  357. X
  358. X      /* Special ARGV-element `--' means premature end of options.
  359. X     Skip it like a null option,
  360. X     then exchange with previous non-options as if it were an option,
  361. X     then skip everything else like a non-option.  */
  362. X
  363. X      if (optind != argc && !strcmp (argv[optind], "--"))
  364. X    {
  365. X      optind++;
  366. X
  367. X      if (first_nonopt != last_nonopt && last_nonopt != optind)
  368. X        exchange (argv);
  369. X      else if (first_nonopt == last_nonopt)
  370. X        first_nonopt = optind;
  371. X      last_nonopt = argc;
  372. X
  373. X      optind = argc;
  374. X    }
  375. X
  376. X      /* If we have done all the ARGV-elements, stop the scan
  377. X     and back over any non-options that we skipped and permuted.  */
  378. X
  379. X      if (optind == argc)
  380. X    {
  381. X      /* Set the next-arg-index to point at the non-options
  382. X         that we previously skipped, so the caller will digest them.  */
  383. X      if (first_nonopt != last_nonopt)
  384. X        optind = first_nonopt;
  385. X      return EOF;
  386. X    }
  387. X
  388. X      /* If we have come to a non-option and did not permute it,
  389. X     either stop the scan or describe it to the caller and pass it by.  */
  390. X
  391. X      if (argv[optind][0] != '-' || argv[optind][1] == 0)
  392. X    {
  393. X      if (ordering == REQUIRE_ORDER)
  394. X        return EOF;
  395. X      optarg = argv[optind++];
  396. X      return 0;
  397. X    }
  398. X
  399. X      /* We have found another option-ARGV-element.
  400. X     Start decoding its characters.  */
  401. X
  402. X      nextchar = argv[optind] + 1;
  403. X    }
  404. X
  405. X  /* Look at and handle the next option-character.  */
  406. X
  407. X  {
  408. X    char c = *nextchar++;
  409. X    char *temp = (char *) index (optstring, c);
  410. X
  411. X    /* Increment `optind' when we start to process its last character.  */
  412. X    if (*nextchar == 0)
  413. X      optind++;
  414. X
  415. X    if (temp == 0 || c == ':')
  416. X      {
  417. X    if (opterr != 0)
  418. X      {
  419. X        if (c < 040 || c >= 0177)
  420. X          fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
  421. X               argv[0], c);
  422. X        else
  423. X          fprintf (stderr, "%s: unrecognized option `-%c'\n",
  424. X               argv[0], c);
  425. X      }
  426. X    return '?';
  427. X      }
  428. X    if (temp[1] == ':')
  429. X      {
  430. X    if (temp[2] == ':')
  431. X      {
  432. X        /* This is an option that accepts an argument optionally.  */
  433. X        if (*nextchar != 0)
  434. X          {
  435. X            optarg = nextchar;
  436. X        optind++;
  437. X          }
  438. X        else
  439. X          optarg = 0;
  440. X        nextchar = 0;
  441. X      }
  442. X    else
  443. X      {
  444. X        /* This is an option that requires an argument.  */
  445. X        if (*nextchar != 0)
  446. X          {
  447. X        optarg = nextchar;
  448. X        /* If we end this ARGV-element by taking the rest as an arg,
  449. X           we must advance to the next element now.  */
  450. X        optind++;
  451. X          }
  452. X        else if (optind == argc)
  453. X          {
  454. X        if (opterr != 0)
  455. X          fprintf (stderr, "%s: no argument for `-%c' option\n",
  456. X               argv[0], c);
  457. X        c = '?';
  458. X          }
  459. X        else
  460. X          /* We already incremented `optind' once;
  461. X         increment it again when taking next ARGV-elt as argument.  */
  462. X          optarg = argv[optind++];
  463. X        nextchar = 0;
  464. X      }
  465. X      }
  466. X    return c;
  467. X  }
  468. X}
  469. X
  470. Xmemcpy(s,d,len)
  471. Xchar *s,*d;
  472. Xint len;
  473. X{
  474. X    while(len--) *d++ = *s++;
  475. X}
  476. END_OF_FILE
  477. if test 16259 -ne `wc -c <'getopt.c'`; then
  478.     echo shar: \"'getopt.c'\" unpacked with wrong size!
  479. fi
  480. # end of 'getopt.c'
  481. fi
  482. if test -f 'parse_keys.c' -a "${1}" != "-c" ; then 
  483.   echo shar: Will not clobber existing file \"'parse_keys.c'\"
  484. else
  485. echo shar: Extracting \"'parse_keys.c'\" \(15394 characters\)
  486. sed "s/^X//" >'parse_keys.c' <<'END_OF_FILE'
  487. X
  488. X#include "file+rk.h"
  489. X#include "functions.h"
  490. X#include <stdio.h>
  491. X#include <sys/ioctl.h>
  492. X#include <ctype.h>
  493. X
  494. X#define MAXKEYLEN 19
  495. X#define MAXTOKEN  30
  496. X#define UPCASE(c) (islower(c)?toupper(c):c)
  497. X
  498. X#define UPCASE(c) (islower(c)?toupper(c):c)
  499. X#define KEYWORDS (sizeof(functions)/sizeof(struct func))
  500. X#define isodigit(c) ((isdigit(c))&&(c<'8'))
  501. X
  502. XFILE *filedesc;
  503. Xchar *key_file;
  504. X
  505. Xextern int (*keymap[128][MAXEXTENSIONS])();
  506. Xextern char meta_prefixes[MAXEXTENSIONS][MAXEXTENSIONS];
  507. Xextern int  meta_map[MAXEXTENSIONS][MAXEXTENSIONS];
  508. Xextern char next_free_map;
  509. Xextern char tc_ent[1024], tc_seq_buf[1024];
  510. Xextern struct sgttyb   new_stdin, old_stdin;
  511. X
  512. Xchar *tgetstr();
  513. Xstruct func {
  514. X    char *name;
  515. X    int (*address)();
  516. X    char *description;
  517. X} functions[]=
  518. X    {
  519. X        {"BOGUS",
  520. X          BOGUS,
  521. X         "Null routine, beeps terminal bell"},
  522. X
  523. X        {"accept_forward_char",
  524. X          accept_forward_char,
  525. X         "Accept the next predicted character"},
  526. X
  527. X        {"accept_forward_word",
  528. X          accept_forward_word,
  529. X         "Accept the next predicted word"},
  530. X
  531. X        {"accept_to_end_of_line",
  532. X          accept_to_end_of_line,
  533. X         "Accept the whole predicted line"},
  534. X
  535. X        {"backspace_char",
  536. X          backspace_char,
  537. X         "Backspace a single character"},
  538. X
  539. X        {"backspace_word",
  540. X          backspace_word,
  541. X         "Backspace a single word"},
  542. X
  543. X        {"backward_char",
  544. X          backward_char,
  545. X         "Go backwards a single character"},
  546. X
  547. X        {"backward_paren",
  548. X          backward_paren,
  549. X         "Go backwards to matching parenthesis \"(\""},
  550. X
  551. X        {"backward_word",
  552. X          backward_word,
  553. X         "Go backwards a single word"},
  554. X
  555. X        {"beginning_of_line",
  556. X          beginning_of_line,
  557. X         "Move to the beginning of the line"},
  558. X
  559. X        {"bogus",
  560. X          BOGUS,
  561. X         "Null routine, beeps terminal bell"},
  562. X
  563. X        {"capitalize_word",
  564. X          capitalize_word,
  565. X         "Capitalize this word"},
  566. X
  567. X        {"clear_display",
  568. X          clear_display,
  569. X         "Clear the screen and redraw the line"},
  570. X
  571. X        {"close_paren",
  572. X          close_paren,
  573. X         "Close and show matching parenthesis"},
  574. X
  575. X        {"command_completion",
  576. X          command_completion,
  577. X         "Expand a command using $PATH"},
  578. X
  579. X        {"dash_to_ul_word",
  580. X          dash_to_ul_word,
  581. X         "Convert -'s to _'s in this word"},
  582. X
  583. X        {"delete_char",
  584. X          delete_char,
  585. X         "Delete a single character"},
  586. X
  587. X        {"delete_region_to_killbuffer",
  588. X          delete_region_to_killbuffer,
  589. X         "Delete marked region to killbuffer"},
  590. X
  591. X        {"delete_word",
  592. X          delete_word,
  593. X         "Delete a single word"},
  594. X
  595. X        {"describe_arguments",
  596. X          describe_arguments,
  597. X         "Show the current command line arguments"},
  598. X
  599. X        {"describe_bindings",
  600. X          describe_bindings,
  601. X         "Show the current key bindings"},
  602. X
  603. X        {"discard_current_edit_line",
  604. X          discard_current_edit_line,
  605. X         "Delete this line and forget it"},
  606. X
  607. X        {"discard_rest_of_line",
  608. X          discard_rest_of_line,
  609. X         "Delete rest of line to killbuffer"},
  610. X
  611. X        {"end_of_line",
  612. X          end_of_line,
  613. X         "Move to the end of the line"},
  614. X
  615. X        {"file_completion",
  616. X          file_completion,
  617. X         "Expand pathname from the current prefix"},
  618. X
  619. X        {"finish_editing_line",
  620. X          finish_editing_line,
  621. X         "Enter this line"},
  622. X
  623. X        {"forward_char",
  624. X          forward_char,
  625. X         "Go forward a single character"},
  626. X
  627. X        {"forward_paren",
  628. X          forward_paren,
  629. X         "Move to matching close parenthesis \")\""},
  630. X
  631. X        {"forward_word",
  632. X          forward_word,
  633. X         "Go forward a single word"},
  634. X
  635. X        {"increment_universal_argument",
  636. X          increment_universal_argument,
  637. X         "Do the next command 4^(presses) times"},
  638. X
  639. X        {"insert_interrupt_char",
  640. X          insert_interrupt_char,
  641. X         "Send an interrupt character"},
  642. X
  643. X        {"insert_quit_char",
  644. X          insert_quit_char,
  645. X         "Send a quit character"},
  646. X
  647. X        {"insert_start_char",
  648. X          insert_start_char,
  649. X         "Send a start character"},
  650. X
  651. X        {"insert_stop_char",
  652. X          insert_stop_char,
  653. X         "Send a stop character"},
  654. X
  655. X        {"insert_suspend_char",
  656. X          insert_suspend_char,
  657. X         "Send a suspend character"},
  658. X
  659. X        {"lowercase_word",
  660. X          lowercase_word,
  661. X         "Lowercase this word"},
  662. X
  663. X        {"next_line",
  664. X          next_line,
  665. X         "Show the next line buffer"},
  666. X
  667. X        {"next_pred",
  668. X          next_pred,
  669. X         "Show next alternative prediction"},
  670. X
  671. X        {"null",
  672. X          BOGUS,
  673. X         "Null routine, beeps terminal bell"},
  674. X
  675. X        {"open_paren",
  676. X          open_paren,
  677. X         "Open and show matching parenthesis"},
  678. X
  679. X        {"previous_line",
  680. X          previous_line,
  681. X         "Show the previous line buffer"},
  682. X
  683. X        {"previous_pred",
  684. X          previous_pred,
  685. X         "Show the previous alternative prediction"},
  686. X
  687. X        {"prime_from_file",
  688. X          prime_from_file,
  689. X         "Prime the predictions from a file"},
  690. X
  691. X        {"quote_char",
  692. X          quote_char,
  693. X         "Literally insert the next character"},
  694. X
  695. X        {"run_mesg",
  696. X          run_mesg,
  697. X         "Run the mesg command"},
  698. X
  699. X        {"run_ruptime",
  700. X          run_ruptime,
  701. X         "Run the ruptime command"},
  702. X
  703. X        {"run_talk",
  704. X          run_talk,
  705. X         "Run the talk command"},
  706. X
  707. X        {"run_tty_program",
  708. X          run_tty_program,
  709. X         "Run a program with rk turned off"},
  710. X
  711. X        {"run_write",
  712. X          run_write,
  713. X         "Run the write command"},
  714. X
  715. X        {"self_insert",
  716. X          self_insert,
  717. X         "Literally insert the current character"},
  718. X
  719. X        {"set_mark",
  720. X          set_mark,
  721. X         "Set mark at the current cursor position"},
  722. X
  723. X        {"show_free_nodes",
  724. X          show_free_nodes,
  725. X         "Show memory usage info for debugging"},
  726. X
  727. X        {"show_mark",
  728. X          show_mark,
  729. X         "Show the position of the current mark"},
  730. X
  731. X        {"show_version",
  732. X          show_version,
  733. X         "Show the current version number and date"},
  734. X
  735. X        {"toggle_add_space_mode",
  736. X          toggle_add_space_mode,
  737. X         "Toggle add_space_mode (see manual)"},
  738. X
  739. X        {"toggle_eol_longer_mode",
  740. X          toggle_eol_longer_mode,
  741. X         "Toggle eol_longer_mode (see manual)"},
  742. X
  743. X        {"toggle_eol_only_mode",
  744. X          toggle_eol_only_mode,
  745. X         "Toggle eol_only_mode (see manual)"},
  746. X
  747. X        {"toggle_lisp_mode",
  748. X          toggle_lisp_mode,
  749. X         "Toggle lisp_mode (see manual)"},
  750. X
  751. X        {"toggle_nl_truncate_mode",
  752. X          toggle_nl_truncate_mode,
  753. X         "Toggle nl_truncate_mode (see manual)"},
  754. X
  755. X        {"toggle_pred_mode",
  756. X          toggle_pred_mode,
  757. X         "Turn prediction display off or on"},
  758. X
  759. X        {"toggle_show_eol_mode",
  760. X          toggle_show_eol_mode,
  761. X         "Toggle display of ^J at end of line"},
  762. X
  763. X        {"twiddle_chars",
  764. X          twiddle_chars,
  765. X         "Exchange previous two characters"},
  766. X
  767. X        {"ul_to_dash_word",
  768. X          ul_to_dash_word,
  769. X         "Convert _'s to -'s in this word"},
  770. X
  771. X        {"uppercase_word",
  772. X          uppercase_word,
  773. X         "Uppercase this word"},
  774. X
  775. X        {"yank_from_kill_buffer",
  776. X          yank_from_kill_buffer,
  777. X         "Insert text stored in killbuffer"}
  778. X    };
  779. X
  780. X
  781. Xstruct list {
  782. X    char *key;
  783. X    struct list *next;
  784. X} *bindings[sizeof(functions)/sizeof(struct func)];
  785. X
  786. X
  787. X
  788. X/***********************************\
  789. X*                     *
  790. X*  binary search from K&R "C" book  *
  791. X*                     *
  792. X\***********************************/
  793. X
  794. Xbsearch(s)
  795. Xchar *s;
  796. X{
  797. X    int low, high, mid, cond;
  798. X    low=0;
  799. X    high= KEYWORDS-1;
  800. X    while( low<= high) {
  801. X        mid = (low+high)/2;
  802. X        if( (cond = strcmp(s,functions[mid].name)) < 0)
  803. X            high=mid-1;
  804. X        else if (cond>0)
  805. X            low=mid+1;
  806. X        else
  807. X            return(mid);
  808. X    }
  809. X    return(-1);
  810. X}
  811. X
  812. Xparse_command()
  813. X{
  814. X    int x=1;
  815. X    int number;
  816. X    char c;
  817. X    char token[MAXTOKEN];
  818. X
  819. X
  820. X    while(isspace(c=fgetc(filedesc)));
  821. X    
  822. X    token[0]=c;
  823. X
  824. X    while((isalpha(c=fgetc(filedesc)) || (c=='_'))&& (x<=MAXTOKEN))
  825. X        token[x++]=c;
  826. X
  827. X    token[x]=0;
  828. X    if (c==EOF) return(-1);
  829. X
  830. X    if ((!isspace(c)) && (c!=EOF)){
  831. X        printf("Unexpected character '%c', Expecting whitespace or EOF.\n",c);
  832. X        return(-1);
  833. X    }
  834. X    if(x>MAXTOKEN){
  835. X        printf("Function name too long: '%s'\n",token);
  836. X        return(-1);
  837. X    }
  838. X    number=bsearch(token);
  839. X    if(number==-1)
  840. X        printf("Function not found: %s\n",token);
  841. X    return(number);
  842. X}
  843. X
  844. X
  845. Xchar get_cntl()
  846. X{
  847. X    int c=fgetc(filedesc);
  848. X    
  849. X    if(c==' ') return(200); /* Can't use 0 */
  850. X    else if(c==EOF){
  851. X        printf("Unexpected EOF\n");
  852. X        return(200);
  853. X    }else return(UPCASE(c)-'@');
  854. X}
  855. X
  856. Xchar parse_cntl(key)
  857. Xchar key;
  858. X{
  859. X    if(key==0) abortit("Invalid ^ in key binding.\n",-1);
  860. X    if(key==' ') return(0);
  861. X    else return(UPCASE(key)-'@');
  862. X}
  863. X
  864. X
  865. Xchar get_slash()
  866. X{
  867. X
  868. X    int c=fgetc(filedesc);
  869. X    int code=0;
  870. X
  871. X    if(isodigit(c)){
  872. X        while(isodigit(c)){
  873. X            if((256-(c-='0'))<code){
  874. X                printf("Character Overflow\n");
  875. X                return(code);
  876. X            }
  877. X            code=(code<<3)+c;
  878. X            c=fgetc(filedesc);
  879. X        }
  880. X        ungetc(c,filedesc);
  881. X        return((char)code);
  882. X    }
  883. X    else if(c=='E')
  884. X        return(27);
  885. X    else if(c=='n')
  886. X        return('\n');
  887. X    else if(c=='r')
  888. X        return('\r');
  889. X    else if(c=='t')
  890. X        return('\t');
  891. X    else if(c=='b')
  892. X        return('\b');
  893. X    else if(c=='f')
  894. X        return('\f');
  895. X    else return(c);
  896. X}    
  897. X
  898. Xchar parse_slash(key)
  899. Xchar **key;
  900. X{
  901. X
  902. X    int c=(*key)[0];
  903. X    int code=0;
  904. X
  905. X    (*key)++;
  906. X    if(c==0) abortit("Invalid \\ in key binding.\n",-1);
  907. X        
  908. X    if(isodigit(c)){
  909. X        while(isodigit(c)){
  910. X            if((256-(c-='0'))<code){
  911. X                printf("Character Overflow\n");
  912. X                return(code);
  913. X            }
  914. X            code=(code<<3)+c;
  915. X            c=(*key)[0];
  916. X            (*key)++;
  917. X        }
  918. X        (*key)--;
  919. X        return((char)code);
  920. X    }
  921. X    else if(c=='E')
  922. X        return(27);
  923. X    else if(c=='n')
  924. X        return('\n');
  925. X    else if(c=='r')
  926. X        return('\r');
  927. X    else if(c=='t')
  928. X        return('\t');
  929. X    else if(c=='b')
  930. X        return('\b');
  931. X    else if(c=='f')
  932. X        return('\f');
  933. X    else return(c);
  934. X}    
  935. X    
  936. X
  937. Xchar *parse_key(key)
  938. Xchar *key;
  939. X{
  940. X    static char ret_key[20];
  941. X    int  x=0;
  942. X    int  retval;
  943. X    char c;
  944. X
  945. X    while(((c=key[0])!='\0') && (x<=MAXKEYLEN)){
  946. X        if(c=='\\'){
  947. X            key++;
  948. X            ret_key[x++]=parse_slash(&key);
  949. X        }
  950. X        else if(c=='^'){
  951. X            ret_key[x++]=parse_cntl(key[1]);
  952. X            key+=2;
  953. X        }        
  954. X        else{
  955. X            ret_key[x++]=c;
  956. X            key++;
  957. X        }
  958. X    }
  959. X    ret_key[x]=0;
  960. X
  961. X    if(x>MAXKEYLEN){
  962. X        printf("Key too long.\n");
  963. X        return((char *)-1);
  964. X    }
  965. X    return(ret_key);
  966. X}
  967. X
  968. Xchar *parse_termcap_key(key)
  969. Xchar *key;
  970. X{
  971. X    char *term_key;
  972. X    char term_cap[3];    
  973. X    char *key_ptr;
  974. X    
  975. X
  976. X    term_key = tc_seq_buf;
  977. X    key_ptr=tgetstr(key,&term_key);
  978. X    if(!key_ptr){
  979. X        printf("Unavailable Terminal Capability: %s\n",term_cap);
  980. X        return((char *) -1);
  981. X    }else
  982. X        return(key_ptr); 
  983. X}
  984. X
  985. Xchar *get_key(buffer)
  986. Xchar *buffer;
  987. X{
  988. X    static char key[20];
  989. X    char *term_key;
  990. X    char *key_ptr;
  991. X    char term_cap[3];    
  992. X    int  x=0;
  993. X    int  c;
  994. X    int  retval;
  995. X    
  996. X    while(isspace(c=fgetc(filedesc)));
  997. X    if (c!='"'){
  998. X        term_cap[0]=c;
  999. X        term_cap[1]=fgetc(filedesc);
  1000. X        term_cap[2]=0;
  1001. X        term_key = tc_seq_buf;
  1002. X        key_ptr=tgetstr(term_cap,&term_key);
  1003. X        if(!key_ptr){
  1004. X            printf("Unavailable Terminal Capability: %s\n",term_cap);
  1005. X            return((char *) -1);
  1006. X        }
  1007. X        else{
  1008. X            strcpy(buffer,term_cap);
  1009. X            return(key_ptr);
  1010. X        }
  1011. X    }
  1012. X
  1013. X    while(((c=fgetc(filedesc))!='\"') && (c!=EOF) 
  1014. X            && (x<=MAXKEYLEN)){
  1015. X        if(c=='\\') key[x++]=get_slash();
  1016. X        else if(c=='^') key[x++]=get_cntl();
  1017. X        else key[x++]=c;
  1018. X    }
  1019. X    key[x]=0;
  1020. X
  1021. X    if(x>MAXKEYLEN){
  1022. X        printf("Key too long.\n");
  1023. X        return((char *)-1);
  1024. X    }
  1025. X    strcpy(buffer,key);
  1026. X    return(key);
  1027. X}
  1028. X
  1029. X/***************************************************************************\
  1030. X*                                         *
  1031. X* Find the length of a string but count control chars as two so the length  *
  1032. X* of something like ^C is right                            *
  1033. X*                                         *
  1034. X\***************************************************************************/
  1035. XStrlen(str)
  1036. Xchar *str;
  1037. X{
  1038. X    register int len=0;
  1039. X    while(*str){
  1040. X        if((*str<32) || (*str==127))
  1041. X            len++;
  1042. X        len++;
  1043. X        str++;
  1044. X    }
  1045. X    return(len);
  1046. X}
  1047. X/*****************************************************************\
  1048. X*                                   *
  1049. X* Copy from b to a but replace control chars with ^-char like ^C  *
  1050. X*                                   *
  1051. X\*****************************************************************/
  1052. XStrcpy(a,b)
  1053. Xchar *a,*b;
  1054. X{
  1055. X    while(*b){
  1056. X        if((*b<32) || (*b==127)){
  1057. X            *a++='^';
  1058. X            *a++=(*b==127)?b++,'?':(*b++)+'@';
  1059. X        }                
  1060. X        *a++ = *b++;
  1061. X    }
  1062. X    *a=0;
  1063. X}
  1064. X
  1065. X
  1066. Xadd_to_bindings(key,function)
  1067. Xchar *key;
  1068. Xint (*function)();
  1069. X{
  1070. X    int x,found_it=0;
  1071. X    struct list *current,*previous;
  1072. X    char good_key[30];
  1073. X    Strcpy(good_key,key);
  1074. X
  1075. X    for(x=0;x<sizeof(functions)/sizeof(struct func);x++){
  1076. X        current=bindings[x];
  1077. X        while(bindings[x]&&!strcmp(bindings[x]->key,good_key)){
  1078. X            current=bindings[x]->next;
  1079. X            free(bindings[x]);
  1080. X            bindings[x]=current;
  1081. X        }
  1082. X        while(current!=0){
  1083. X            if(!strcmp(current->key,good_key)){
  1084. X                previous->next=current->next;
  1085. X                free(current);
  1086. X            }
  1087. X            previous=current;
  1088. X            current=current->next;
  1089. X        }
  1090. X
  1091. X    }
  1092. X    for(x=0;x<sizeof(functions)/sizeof(struct func);x++){
  1093. X        if(function==functions[x].address){
  1094. X            found_it=1;
  1095. X            break;
  1096. X        }
  1097. X    }
  1098. X    if(found_it){
  1099. X        if(bindings[x]==0){
  1100. X            bindings[x]=(struct list *)malloc(sizeof(struct list));
  1101. X            bindings[x]->key=malloc(Strlen(key)+1);
  1102. X            Strcpy(bindings[x]->key,key);
  1103. X            bindings[x]->next=0;
  1104. X        } else {
  1105. X            current=bindings[x];
  1106. X            while(current->next != 0)
  1107. X                current=current->next;
  1108. X            current->next=(struct list *)malloc(sizeof(struct list));
  1109. X            current->next->key=malloc(Strlen(key)+1);
  1110. X            Strcpy(current->next->key,key);
  1111. X            current->next->next=0;
  1112. X        }
  1113. X    }
  1114. X}            
  1115. X            
  1116. X
  1117. X
  1118. Xbind_to_key(key,function)
  1119. Xchar *key;
  1120. Xint (*function)();
  1121. X{
  1122. X    char *binary_key;    
  1123. X    
  1124. X    binary_key=parse_key(key);
  1125. X    if(binary_key!=(char *)-1){
  1126. X        add_to_bindings(key,function);
  1127. X        do_bind_to_key(binary_key,0,function);
  1128. X    }
  1129. X}
  1130. X
  1131. Xbind_termcap_key(key,function)
  1132. Xchar *key;
  1133. Xint (*function)();
  1134. X{
  1135. X    char *binary_key;    
  1136. X    
  1137. X    binary_key=parse_termcap_key(key);
  1138. X    if(binary_key!=(char *)-1){
  1139. X        add_to_bindings(key,function);
  1140. X        do_bind_to_key(binary_key,0,function);
  1141. X    }
  1142. X}
  1143. X
  1144. Xdo_bind_to_key(key,current_key_map,function)
  1145. Xchar *key;
  1146. Xchar  current_key_map;
  1147. Xint (*function)();
  1148. X{
  1149. X    int x;
  1150. X
  1151. X    
  1152. X    if((strlen(key)==1) || (strlen(key)==0)){
  1153. X        keymap[key[0]][current_key_map]=function;
  1154. X    } else {
  1155. X        for(x=0;(x<MAXEXTENSIONS)&&(meta_prefixes[x][current_key_map])&&
  1156. X            (key[0]!=meta_prefixes[x][current_key_map]);x++);
  1157. X        if(x==MAXEXTENSIONS){
  1158. X            abortit("Too many keymaps, aborting.\r\n",-1);
  1159. X        }else if(meta_prefixes[x][current_key_map]){
  1160. X            do_bind_to_key(key+1,meta_map[x][current_key_map],function);
  1161. X        }else {
  1162. X            meta_prefixes[x][current_key_map]=key[0];
  1163. X            meta_map[x][current_key_map]=next_free_map;
  1164. X            keymap[key[0]][current_key_map]=meta_prefix;
  1165. X            next_free_map++;
  1166. X            do_bind_to_key(key+1,next_free_map-1,function);
  1167. X            if(next_free_map==MAXEXTENSIONS)
  1168. X                abortit("Too many keymaps, aborting.\r\n",-1);
  1169. X        }
  1170. X    }
  1171. X}
  1172. X
  1173. X
  1174. Xget_key_bindings()
  1175. X{
  1176. X
  1177. X    char *termname, *tbuf, *getenv();
  1178. X    int  function_num;
  1179. X    char *key;
  1180. X    char key_string[30];
  1181. X    int x;
  1182. X
  1183. X    if ((filedesc=fopen(key_file,"r"))==0){
  1184. X        return;
  1185. X    }
  1186. X
  1187. X    do{
  1188. X        function_num=parse_command();
  1189. X        if(function_num==-1)
  1190. X            break;
  1191. X        key=get_key(key_string);
  1192. X        if(key==(char *)-1)
  1193. X            break;
  1194. X        add_to_bindings(key_string,functions[function_num].address);
  1195. X        do_bind_to_key(key,0,functions[function_num].address);
  1196. X    } while(1);
  1197. X    fclose(filedesc);
  1198. X}
  1199. X
  1200. Xint
  1201. Xdescribe_bindings(e)
  1202. X    ED_STRUCT      *e;
  1203. X{
  1204. X    void        (*sig)();
  1205. X    char    reply;
  1206. X    char    fname[100];    
  1207. X        
  1208. X    printf("\r\nSend to a file? (y/n)");
  1209. X    if((reply=getchar())=='Y' || reply == 'y'){
  1210. X        ioctl(0, TIOCGETP, &new_stdin);
  1211. X        ioctl(0, TIOCSETP, &old_stdin);
  1212. X        sig=signal(SIGCHLD,SIG_DFL); 
  1213. X        printf("\nFilename: ");
  1214. X        gets(fname);
  1215. X        show_bindings(fname);
  1216. X    }else{
  1217. X        ioctl(0, TIOCGETP, &new_stdin);
  1218. X        ioctl(0, TIOCSETP, &old_stdin);
  1219. X        sig=signal(SIGCHLD,SIG_DFL); 
  1220. X        fname[0]=0;    
  1221. X        show_bindings(0);
  1222. X    }    
  1223. X    signal(SIGCHLD,sig); 
  1224. X    ioctl(0, TIOCSETP, &new_stdin);
  1225. X    write(1, "Continue: ", 10);
  1226. X    draw_current_edit_line(e);
  1227. X}
  1228. X
  1229. X
  1230. Xshow_bindings(fname)
  1231. X    char *fname;
  1232. X{
  1233. X    int x;
  1234. X    struct list *current;
  1235. X    char *more;
  1236. X    FILE *pipe;
  1237. X
  1238. X    if(!fname)    
  1239. X        if((more=getenv("PAGER"))==0){
  1240. X            if((pipe=popen("more","w"))==0){
  1241. X                perror("more");
  1242. X                return;
  1243. X            }
  1244. X        } else {
  1245. X            if((pipe=popen(more,"w"))==0){
  1246. X                perror(more);
  1247. X                return;
  1248. X            }
  1249. X        }
  1250. X    else
  1251. X        if((pipe=fopen(fname,"w"))==0){
  1252. X            perror(fname);
  1253. X            return;
  1254. X        }
  1255. X    
  1256. X
  1257. X
  1258. X    fprintf(pipe,"\n         FUNCTION NAME       BOUND TO \tDESCRIPTION\n");
  1259. X    fprintf(pipe,"         -------- ----       ----- -- \t-----------\n");
  1260. X
  1261. X    for(x=0;x<(sizeof(functions)/sizeof(struct func));x++){
  1262. X        if((functions[x].address==BOGUS)
  1263. X            || (functions[x].address==self_insert))
  1264. X            continue;
  1265. X        fprintf(pipe,"%28s",functions[x].name);
  1266. X        current=bindings[x];
  1267. X        if(current!=0){
  1268. X            fprintf(pipe,"%6s\t",current->key);
  1269. X            current=current->next;
  1270. X        } else {
  1271. X            fprintf(pipe,"      \t");
  1272. X        }
  1273. X        fprintf(pipe,"%s",functions[x].description);
  1274. X        while(current!=0){
  1275. X            fprintf(pipe,"\n%34s",current->key);
  1276. X            current=current->next;
  1277. X        }
  1278. X        fprintf(pipe,"\n");
  1279. X    }
  1280. X    pclose(pipe);
  1281. X}
  1282. X
  1283. X
  1284. END_OF_FILE
  1285. if test 15394 -ne `wc -c <'parse_keys.c'`; then
  1286.     echo shar: \"'parse_keys.c'\" unpacked with wrong size!
  1287. fi
  1288. # end of 'parse_keys.c'
  1289. fi
  1290. if test -f 'rk.1' -a "${1}" != "-c" ; then 
  1291.   echo shar: Will not clobber existing file \"'rk.1'\"
  1292. else
  1293. echo shar: Extracting \"'rk.1'\" \(17257 characters\)
  1294. sed "s/^X//" >'rk.1' <<'END_OF_FILE'
  1295. X.TH RK 1
  1296. X.SH NAME
  1297. Xrk \- The Reactive Keyboard
  1298. X.SH SYNOPSIS
  1299. X.B "rk [\- options]"
  1300. X.SH DESCRIPTION
  1301. X.I "The Reactive Keyboard"
  1302. Xis a general purpose command line editor with the addition of predictive text
  1303. Xgeneration.  It interfaces with a standard shell and allows simple editing
  1304. Xof input lines.  It will also predict new input lines based on previous
  1305. Xinput.  
  1306. X
  1307. X.SH PREDICTIVE TEXT GENERATION
  1308. X.I "The Reactive Keyboard"
  1309. X(\fIrk\fP) accelerates typewritten communication with a
  1310. Xcomputer system by predicting what the user is going to type next.  To
  1311. Xenable it to make predictions, a model of previously-entered
  1312. Xtext is created and maintained adaptively.  (The modeling technique was
  1313. Xdeveloped for use in text compression, and in fact forms the basis of
  1314. Xone of the most effective existing compression methods.) This generally
  1315. Xcontains a large number of recurring selection element sequences
  1316. X(n-grams), with associated occurrence frequencies.  The current
  1317. Xcontext, recent selections, is used to look up likely continuations.
  1318. X
  1319. XThe basic idea is to order context-conditioned candidate strings, which
  1320. Xare predicted by the model, according to popularity and display them
  1321. Xfor selection.  Each prediction starts with a different \s-2ASCII\s+2
  1322. Xcharacter, so that the entire character set can always be accessed.
  1323. XDisplayed options are actually concatenations of several predicted
  1324. Xcharacters.  With the standard keyboard interface the user can cycle
  1325. Xthrough these predictions and accept all or part of any one.  Accepted
  1326. Xpredictions appear to the computer system as though the user had typed
  1327. Xthem himself.
  1328. X
  1329. XObviously predictions are not always correct, but they are correct
  1330. Xoften enough to form the basis of a useful communication device.  Since
  1331. Xthey are created adaptively, based on what the user has already typed
  1332. Xin this session or in previous ones, the system conforms to whatever
  1333. Xkind of text is being entered.  Prediction accuracy improves continually
  1334. Xas user history accumulates.
  1335. X
  1336. XPresent implementations have proved most useful in enhancing the
  1337. Xcommand interface to the \s-2UNIX\s+2 operating system by predicting commands,
  1338. Xarguments, and filenames; and for the entry of free text.  Although
  1339. Xdesigned as a general purpose computer interface, the Reactive Keyboard
  1340. Xalso has great potential to enhance the ease and rate of communication
  1341. Xfor physically limited people.
  1342. X
  1343. X.SH TECHNICAL DESCRIPTION
  1344. X
  1345. X.I "The Reactive Keyboard"
  1346. Xopens a shell on a pseudo terminal (pty).  Any input typed by the
  1347. Xuser is sent to the standard input of the shell.  Any output from the
  1348. Xshell is simply sent to the screen.  The advantage of this setup is
  1349. Xthat programs do not need to do anything special to work with \fIrk\fP.
  1350. X
  1351. X.I "The Reactive Keyboard"
  1352. Xautomatically switches off when a program is competing for control of the
  1353. Xpty.  Programs like screen editors for example will cause \fIrk\fP to shut off.
  1354. XOther programs can be run with \fIrk\fP turned off with 
  1355. Xthe ``run-tty-program'' function.
  1356. X
  1357. X.SH OPTIONS
  1358. X.IP "\-b <buffers>"
  1359. XThe number of buffers used by \fIrk\fP to save previous commands used by
  1360. X.I "previous_line."
  1361. XDefault: 60.
  1362. X.PP
  1363. X.IP "\-e <eol length>"
  1364. XThe maximum length of predictions at the end of the line. Default: 40.
  1365. X.PP
  1366. X.IP "\-f <count>"
  1367. XThe maximum frequency count for any given context.  Default: 128.
  1368. X.PP
  1369. X.IP "\-i <inline length>"
  1370. XThe maximum length of predictions in the middle of the line. Default: 8.
  1371. X.PP
  1372. X.IP "\-k <keys file>"
  1373. XThe file to read key bindings from.  Default:\fI$HOME/.rk.keys.\FP
  1374. X.PP
  1375. X.IP "\-n <number of nodes>"
  1376. XThe amount of memory to allocate initially to speed up creation of nodes.
  1377. XAfter this memory is used up, more will be allocated, but this will be slower.
  1378. XDefault: 64*1024 nodes.
  1379. X.PP
  1380. X.IP "\-o <model order>"
  1381. XThis argument controls how deep a tree will be built by \fIrk\fP in order to make predictions.  As
  1382. X.I k
  1383. Xincreases, the accuracy of predictions increases, but the speed decreases.
  1384. XDefault: 8.
  1385. X.PP
  1386. X.IP "\-p <prime file>"
  1387. XThe file used to prime the
  1388. X.I "Reactive Keyboard."
  1389. XDefault:
  1390. X.I "$HOME/.rk.log_file."
  1391. X.PP
  1392. X.IP "\-s <startup amount>"
  1393. XThe maximum number of characters to be read from the prime file at startup.
  1394. XDefault: 16*1024.
  1395. X.PP
  1396. X.IP "\-z <zero freq>"
  1397. XThe zero frequency file name.  See Zero Frequency below. This argument defaults to 
  1398. X.I "$HOME/.rk.zero_freq"
  1399. Xif it is not present.
  1400. X.PP
  1401. X.IP "\-A"
  1402. XWhen you accept a predicted word,
  1403. X.I "rk"
  1404. Xusually accepts all characters up to a space.  If the \-A option is present,
  1405. Xthe space is also accepted.
  1406. X.PP
  1407. X.IP "\-E"
  1408. X.I "rk"
  1409. Xnormally never displays predictions in the middle of a line.  If the \-E
  1410. Xoption is present
  1411. X.I "rk"
  1412. Xwill display predictions no matter where the cursor is.
  1413. X.PP
  1414. X.IP "\-L"
  1415. XBy default, predictions made at the end of a line are longer than those made
  1416. Xin the middle of a line.  The \-L option disables this feature.
  1417. X.PP
  1418. X.IP "\-N"
  1419. XNormally, predictions stop at the end of a line.  The \-N option causes
  1420. X.I "rk"
  1421. Xto continue making predictions past the end of the line, allowing several
  1422. Xcommands to be predicted at once.
  1423. X.PP
  1424. X.IP "\-P"
  1425. XThe \-P option disables display of predictions.  If the \-P option is present,
  1426. Xthe predictions are still made, and 
  1427. X.I "rk"
  1428. Xstill reads all input, but the predictions are not displayed.
  1429. X.PP
  1430. X.IP "\-S"
  1431. XNormally, when
  1432. X.I "rk"
  1433. Xpredicts a line, it shows the whole line up to and including the return (^J) at the
  1434. Xend.  If the \-S option is present, the return at the end of the line is not
  1435. Xdisplayed.
  1436. X.IP "\-g"
  1437. XNormally,
  1438. X.I "rk"
  1439. Xopens a login shell.  This means the users .login will be run and it is
  1440. Xpossible to quit
  1441. X.I "rk"
  1442. Xby typing "logout".  The \-g
  1443. Xoption causes
  1444. X.I "rk"
  1445. Xto open a normal shell  and not run the users .login.
  1446. X.PP
  1447. X.IP "\-h"
  1448. XThe \-h option causes a short description of the command line arguments to be
  1449. Xprinted.
  1450. X.PP
  1451. X.IP "\-l"
  1452. XThe \-l option turns on lisp mode, and allows ()'s to be matched.
  1453. X.PP
  1454. X.IP "\-m"
  1455. XIf the \-m option is present, the normal startup messages will be skipped.
  1456. X.PP
  1457. X.IP "\-v"
  1458. XThe \-v option prints the current version of the
  1459. X.I "Reactive Keyboard."
  1460. X.PP
  1461. X
  1462. X.SH "EXAMPLES"
  1463. X
  1464. X.I rk \-gmP
  1465. XSilently open a shell with the line editor enabled, but the predictions turned
  1466. Xoff.
  1467. X
  1468. X.I rk \-h
  1469. XJust print help for the command line arguments.
  1470. X
  1471. X.I rk \-o5
  1472. XRun the predictions, but make the order of the model only 5 instead of 8.
  1473. X
  1474. X.I rk \-z cfreq \-p cprimefile
  1475. XLoads the file cfreq into the zero frequency table and primes the prediction
  1476. Xmechanism with the file cprimefile.  Using these two arguments, it is
  1477. Xpossible to set up different environments for prediction.  In the above
  1478. Xexample, cfreq could have been created using a large C source file as input
  1479. Xand cprimefile could be another large C source file.  With these inputs, the
  1480. Xinput of C programs will be simplified as
  1481. X.I "rk"
  1482. Xwill predict common variable
  1483. Xnames and keywords.
  1484. X
  1485. X
  1486. X.SH "BINDABLE EDITING COMMANDS"
  1487. X
  1488. X.SS "Selection Control"
  1489. X.IP "accept_forward_char"
  1490. XAccept the next predicted character.
  1491. X.PP
  1492. X.IP "accept_forward_word"
  1493. XAccept the next predicted word.
  1494. X.PP
  1495. X.IP "accept_to_end_of_line"
  1496. XAccept the whole predicted line.
  1497. X.PP
  1498. X.IP "next_pred"
  1499. XShow next alternative prediction.
  1500. X.PP
  1501. X.IP "previous_pred"
  1502. XShow the previous alternative prediction.
  1503. X
  1504. X.SS "Display Control"
  1505. X.IP "clear_display"
  1506. XClear the screen and redraw the current edit line.
  1507. X.PP
  1508. X.IP "toggle_add_space_mode"
  1509. XWhen you accept a predicted word,
  1510. X.I "rk"
  1511. Xusually accepts all characters up to a space.  If add_space_mode is true,
  1512. Xthe space is also accepted.
  1513. X.PP
  1514. X.IP "toggle_eol_longer_mode"
  1515. XBy default, predictions made at the end of a line are longer than those made
  1516. Xin the middle of a line.  If eol_longer_mode is turned off this feature is
  1517. Xdisabled.
  1518. X.PP
  1519. X.IP "toggle_eol_only_mode"
  1520. X.I "rk"
  1521. Xnormally never displays predictions in the middle of a line.  If
  1522. Xeol_only_mode is true
  1523. X.I "rk"
  1524. Xwill display predictions no matter where the cursor is.
  1525. X.PP
  1526. X.IP "toggle_nl_truncate_mode"
  1527. XNormally, predictions stop at the end of a line.  If nl_truncate_mode is
  1528. Xfalse,
  1529. X.I "rk"
  1530. Xcontinues making predictions past the end of the line, allowing several
  1531. Xcommands to be predicted at once.
  1532. X.PP
  1533. X.IP "toggle_pred_mode"
  1534. XIF pred_mode is false, display of predictions is disabled.
  1535. XThe predictions are still made, and 
  1536. X.I "rk"
  1537. Xstill reads all input, but the predictions are not displayed.
  1538. X.PP
  1539. X.IP "toggle_show_eol_mode"
  1540. XNormally, when
  1541. X.I "rk"
  1542. Xpredicts a line, it shows the whole line up to and including the return (^J) at the
  1543. Xend.  If the show_eol_mode is false, the return at the end of the line is not
  1544. Xdisplayed.
  1545. X.SS "Model Control"
  1546. X
  1547. X.IP "prime_from_file"
  1548. XPrime the predictions from a file.
  1549. X.PP
  1550. X.IP "show_free_nodes"
  1551. XShow memory usage information for debugging.
  1552. X
  1553. X.SS "Error Control (editing)"
  1554. X.IP "backspace_char"
  1555. XBackspace a single character.
  1556. X.PP
  1557. X.IP "backspace_word"
  1558. XBackspace a single word.
  1559. X.PP
  1560. X.IP "backward_char"
  1561. XGo backwards a single character.
  1562. X.PP
  1563. X.IP "backward_paren"
  1564. XGo backwards to a matching parenthesis ``(''.
  1565. X.PP
  1566. X.IP "backward_word"
  1567. XGo backwards a single word.
  1568. X.PP
  1569. X.IP "beginning_of_line"
  1570. XMove to the beginning of the line.
  1571. X.PP
  1572. X.IP "capitalize_word"
  1573. XCapitalize this word.
  1574. X.PP
  1575. X.IP "close_paren"
  1576. XClose and show matching parenthesis.  This only has a visible effect if
  1577. Xlisp_mode is on.
  1578. X.PP
  1579. X.IP "dash_to_ul_word"
  1580. XConvert \-'s to _'s in this word.
  1581. X.PP
  1582. X.IP "delete_char"
  1583. XDelete a single character.
  1584. X.PP
  1585. X.IP "delete_region_to_killbuffer"
  1586. XDelete marked region to killbuffer.
  1587. X.PP
  1588. X.IP "delete_word"
  1589. XDelete a single word.
  1590. X.PP
  1591. X.IP "discard_current_edit_line"
  1592. XDelete this line and forget it.
  1593. X.PP
  1594. X.IP "discard_rest_of_line"
  1595. XDelete rest of line to killbuffer.
  1596. X.PP
  1597. X.IP "end_of_line"
  1598. XMove to the end of the line.
  1599. X.PP
  1600. X.IP "file_completion"
  1601. XExpand pathname from the current prefix.
  1602. X.PP
  1603. X.IP "finish_editing_line"
  1604. XEnter this line.
  1605. X.PP
  1606. X.IP "forward_char"
  1607. XGo forward a single character.
  1608. X.PP
  1609. X.IP "forward_paren"
  1610. XMove to matching close parenthesis ``)''.
  1611. X.PP
  1612. X.IP "forward_word"
  1613. XGo forward a single word.
  1614. X.PP
  1615. X.IP "increment_universal_argument"
  1616. XDo the next command 4^(presses) times.  For example, assume
  1617. Xincrement_universal_argument is bound to ^U and forward_char is bound top ^F.
  1618. XIf the user types ^U^U^F the cursor will move forward 4^2 or 16 spaces.
  1619. X.PP
  1620. X.IP "insert_interrupt_char"
  1621. XSend an interrupt character. This usually kills the current process.
  1622. X.PP
  1623. X.IP "insert_quit_char"
  1624. XSend a quit character. This usually kills the current process and causes a
  1625. Xcore image to be dumped.
  1626. X.PP
  1627. X.IP "insert_start_char"
  1628. XSend a start character.  This usually continues output stopped by
  1629. Xinsert_stop_char.
  1630. X.PP
  1631. X.IP "insert_stop_char"
  1632. XSend a stop character.  This usually pauses output from a program.
  1633. X.PP
  1634. X.IP "insert_suspend_char"
  1635. XSend a suspend character.  This usually stops a process.
  1636. X.PP
  1637. X.IP "lowercase_word"
  1638. XLowercase this word.
  1639. X.PP
  1640. X.IP "next_line"
  1641. XShow the next line buffer.
  1642. X.PP
  1643. X.IP "open_paren"
  1644. XOpen and show matching parenthesis.  This only has a visible effect if
  1645. Xlisp_mode is on.
  1646. X.PP
  1647. X.IP "previous_line"
  1648. XShow the previous line buffer.
  1649. X.PP
  1650. X.IP "quote_char"
  1651. XLiterally insert the next character.
  1652. X.PP
  1653. X.IP "self_insert"
  1654. XLiterally insert the current character.
  1655. X.PP
  1656. X.IP "set_mark"
  1657. XSet mark at the current cursor position.
  1658. X.PP
  1659. X.IP "show_mark"
  1660. XShow the position of the current mark.
  1661. X.PP
  1662. X.IP "toggle_lisp_mode"
  1663. XWhen lisp mode is turned on,
  1664. X.I rk
  1665. Xwill automatically match parenthesis.
  1666. X.PP
  1667. X.IP "twiddle_chars"
  1668. XExchange previous two characters.
  1669. X.PP
  1670. X.IP "ul_to_dash_word"
  1671. XConvert _'s to \-'s in this word.
  1672. X.PP
  1673. X.IP "uppercase_word"
  1674. XUppercase this word.
  1675. X.PP
  1676. X.IP "yank_from_kill_buffer"
  1677. XInsert text stored in killbuffer.
  1678. X.PP
  1679. X
  1680. X.SS "Panic Control"
  1681. X.IP "describe_arguments"
  1682. XShow the current command line arguments.
  1683. X.PP
  1684. X.IP "describe_bindings"
  1685. XShow the current key bindings.  This is usually bound to Esc-?.
  1686. X.PP
  1687. X.IP "show_version"
  1688. XShow the current version number and date.
  1689. X.PP
  1690. X.SS "Other"
  1691. X.IP "BOGUS, bogus or null"
  1692. XNull routine, beeps terminal bell.  If you want to unbind a key, bind
  1693. Xit to this command.
  1694. X.PP
  1695. X.IP "command_completion"
  1696. XExpand a command using $PATH.
  1697. X.PP
  1698. X.IP "run_mesg"
  1699. XRun the mesg command.
  1700. X.PP
  1701. X.IP "run_ruptime"
  1702. XRun the ruptime command.
  1703. X.PP
  1704. X.IP "run_talk"
  1705. XRun the talk command.
  1706. X.PP
  1707. X.IP "run_tty_program"
  1708. XRun a program with \fIrk\fP turned off.
  1709. X.PP
  1710. X.IP "run_write"
  1711. XRun the write command.
  1712. X.PP
  1713. X
  1714. X
  1715. X.SH CHANGING KEY BINDINGS
  1716. XOn startup, 
  1717. X.I rk
  1718. Xlooks for the file \fI$HOME/.rk.keys\fP or a file specified by the \-k option.
  1719. XIf it exists,
  1720. X.I rk
  1721. Xreads new key bindings from it.  Bindings consist of a function name
  1722. Xfollowed by a key to bind to in double quotes (").  Control characters
  1723. Xmay be imbedded in this string by the ^ character, so ^A is Control-A.
  1724. XThe \\ character works the same way as the \\ character in termcap entries:
  1725. X.TS
  1726. Xcenter,tab (@);
  1727. Xl.
  1728. X\\\\E is Escape
  1729. X\\\\n is newline
  1730. X\\\\r is carrige return
  1731. X\\\\t is tab
  1732. X\\\\\\\\ is a single \\\\
  1733. X\\\\^ is a single ^
  1734. X.TE
  1735. X
  1736. XIf you leave off the quotes, the corresponding entry is read from the termcap file.  See the manual entry for termcap for a list of these capabilities.
  1737. X
  1738. XFor example, a file like this:
  1739. X.TS
  1740. Xcenter,tab (@);
  1741. Xl.
  1742. Xaccept_forward_word    "^N"
  1743. Xdescribe_bindings      "^[?"
  1744. Xtoggle_lisp_mode       k1
  1745. X.TE
  1746. X
  1747. Xwould bind Control-N to accept_forward_word, Escape-? to describe_bindings
  1748. Xand Function key F1 to toggle_lisp_mode
  1749. X
  1750. X.SH DEFAULT BINDINGS
  1751. X
  1752. XThe default bindings are as follows (Note ^[p means Esc-p):
  1753. X.TS
  1754. Xcenter,tab (@);
  1755. Xl l.
  1756. Xaccept_forward_char@^Q
  1757. Xaccept_forward_word@^W
  1758. Xaccept_to_end_of_line@^S
  1759. Xbackspace_char@^H
  1760. Xbackspace_word@^G or ^[h
  1761. Xbackward_char@^B or kl
  1762. Xbackward_paren@^[(
  1763. Xbackward_word@^[b
  1764. Xbeginning_of_line@^A
  1765. Xcapitalize_word@^[c
  1766. Xclear_display@^L
  1767. Xclose_paren@)
  1768. Xcommand_completion@^\\
  1769. Xdash_to_ul_word@^[_
  1770. Xdelete_char@^D
  1771. Xdelete_region_to_killbuffer@^[k
  1772. Xdelete_word@^[d
  1773. Xdescribe_arguments@^[C
  1774. Xdescribe_bindings@^[?
  1775. Xdiscard_current_edit_line@^[^[
  1776. Xdiscard_rest_of_line@^K
  1777. Xend_of_line@^E
  1778. Xfile_completion@^C
  1779. Xfinish_editing_line@^J or ^M
  1780. Xforward_char@^F or kr
  1781. Xforward_paren@^[)
  1782. Xforward_word@^[f
  1783. Xincrement_universal_argument@^U
  1784. Xinsert_interrupt_char@^?
  1785. Xinsert_quit_char@^[Q
  1786. Xinsert_start_char@^_
  1787. Xinsert_stop_char@^^
  1788. Xinsert_suspend_char@^Z
  1789. Xlowercase_word@^[l
  1790. Xnext_line@^N or kd
  1791. Xnext_pred@^R
  1792. Xopen_paren@(
  1793. Xprevious_line@^P,^[= or ku
  1794. Xprevious_pred@^O
  1795. Xprime_from_file@^[g
  1796. Xquote_char@^V
  1797. Xrun_mesg@^[m
  1798. Xrun_ruptime@^[z
  1799. Xrun_talk@^[t
  1800. Xrun_tty_program@^[r
  1801. Xrun_write@^[w
  1802. Xset_mark@^space
  1803. Xshow_free_nodes@^[q
  1804. Xshow_mark@^X
  1805. Xshow_version@^[v
  1806. Xtoggle_add_space_mode@^[space
  1807. Xtoggle_eol_longer_mode@^[F
  1808. Xtoggle_eol_only_mode@^[E or ^[e
  1809. Xtoggle_lisp_mode@^[L
  1810. Xtoggle_nl_truncate_mode@^[N
  1811. Xtoggle_pred_mode@^[P or^[p
  1812. Xtoggle_show_eol_mode@^[S
  1813. Xtwiddle_chars@^T
  1814. Xul_to_dash_word@^[\-
  1815. Xuppercase_word@^[u
  1816. Xyank_from_kill_buffer@^Y
  1817. X.TE
  1818. X
  1819. X
  1820. X.SH ZERO FREQUENCY FILE
  1821. X
  1822. XWhen the current input has never been encountered before, 
  1823. X.I "rk"
  1824. Xis forced to
  1825. Xconsult it's zero frequency data.  If it exists, the file
  1826. X\fI$HOME/.rk.zero_freq\fP is read at startup.  If not, 
  1827. X.I "rk"
  1828. Xuses a default zero
  1829. Xfrequency table.  The program "freq" will create zero frequency files for
  1830. Xyou.  Simply run "freq < input_data > output_file" and the frequency's of
  1831. Xcharacters in the file input_data will be used to generate the file
  1832. Xoutput_file.
  1833. X
  1834. X
  1835. X.SH ADDING A NEW EDITING FUNCTION
  1836. X
  1837. XIf you want to add a new function to
  1838. X.I The Reactive Keyboard
  1839. Xyou need to add the function name, address and description in the
  1840. Xparse_keys.c file and the function declaration in functions.h
  1841. X
  1842. X
  1843. X.SH "FILES"
  1844. X
  1845. X.IP "freq"
  1846. XA program to generate zero frequency files.
  1847. X.IP ".rk.logfile"
  1848. XThe default file to use to prime the prediction mechanism and store all of
  1849. Xthe users input.
  1850. X.PP
  1851. X.IP ".rk.keys"
  1852. XThe default key bindings file. See Key Bindings above.
  1853. X.PP
  1854. X.IP ".rk.zero_freq"
  1855. XThe default zero frequency file. See Zero Frequency above.
  1856. X.PP
  1857. X
  1858. X.SH "AUTHORS (WHO TO BLAME)"
  1859. X
  1860. X  Mark James   (Key Bindings, Command Line arguments, General Maintainence)
  1861. X  John Darragh (Reactive Keyboard)
  1862. X  Dan Freedman (Input Line Editor)
  1863. X  Doug Taylor  (File Completion)
  1864. X
  1865. X
  1866. X.SH "SEE ALSO"
  1867. X
  1868. Xcsh(1),termcap(5)
  1869. X
  1870. XDarragh, J.J. (1988) ``Adaptive Predictive Text Generation And The Reactive
  1871. XKeyboard'' Research Report 88/343/05, Computer Science Department,
  1872. XUniversity of Calgary
  1873. X
  1874. X.SH "KNOWN BUGS"
  1875. X
  1876. XOn some terminals, 
  1877. X.I rk
  1878. Xhas problems with displaying predictions at the right edge of the screen.  If
  1879. Xthe terminal wraps some highlighted text may be left on the previous line.
  1880. X
  1881. X
  1882. XThe line editor doesn't do enough checking on the size of the input.  If the
  1883. Xuser types too much input before hitting return,
  1884. X.I rk
  1885. Xwill crash.
  1886. X
  1887. XFile completion reads a character to see if it should show a different
  1888. Xcompletion.  This is completely incompatible with the key bindings code.
  1889. XSince file completion only reads one character it is impossible to bind file
  1890. Xcompletion to a multi-character key like ESC-[-A.  At the moment, the key
  1891. Xbindings code does not make a special case for file completion so it is
  1892. Ximpossible to bind file completion to a different key without changing the
  1893. Xsource. This will hopefully be fixed in future versions.
  1894. X
  1895. XFile completion also makes some fairly liberal assumptions about the current
  1896. Xworking directory.  It is fairly simple to trick it into thinking it is in a
  1897. Xdifferent directory than it really is.
  1898. X
  1899. X.SH "WISH LIST"
  1900. X
  1901. XIt would be nice to be able to add teleportation or time travel, but I
  1902. Xunfortunately do not have time to implement these features.
  1903. X
  1904. XIt should not be too difficult to allow bindings to be changed at run time.
  1905. X
  1906. X.SH "BUG REPORTS"
  1907. X
  1908. XSend any bug reports or fixes to jamesm@cpsc.ucalgary.ca.
  1909. X
  1910. END_OF_FILE
  1911. if test 17257 -ne `wc -c <'rk.1'`; then
  1912.     echo shar: \"'rk.1'\" unpacked with wrong size!
  1913. fi
  1914. # end of 'rk.1'
  1915. fi
  1916. echo shar: End of archive 2 \(of 4\).
  1917. cp /dev/null ark2isdone
  1918. MISSING=""
  1919. for I in 1 2 3 4 ; do
  1920.     if test ! -f ark${I}isdone ; then
  1921.     MISSING="${MISSING} ${I}"
  1922.     fi
  1923. done
  1924. if test "${MISSING}" = "" ; then
  1925.     echo You have unpacked all 4 archives.
  1926.     rm -f ark[1-9]isdone
  1927. else
  1928.     echo You still need to unpack the following archives:
  1929.     echo "        " ${MISSING}
  1930. fi
  1931. ##  End of shell archive.
  1932. exit 0
  1933.  
  1934.